#!/usr/bin/env ruby

if ARGV.size < 2
  $stderr.puts "Usage: compare <from branch> <to branch> [brand] [camera]"
  exit 2
end

if !File.exists?(File.expand_path("data/samples", File.dirname(__FILE__)))
  $stderr.puts "ERROR: There is no data/samples, please run fetch-samples first"
  exit 3
end

# Limit of number of files to process per camera, nil is unlimited
PER_CAMERA_LIMIT=nil

require File.expand_path "src/all.rb", File.dirname(__FILE__)

# Lets setup our environment first
build_c_util("imgcmp")
from = DTBuild.new ARGV[0]
to = DTBuild.new ARGV[1]

runner = Runner.new(:brand => ARGV[2], :camera => ARGV[3], :camera_limit => PER_CAMERA_LIMIT)

runner.compare_web(from, to, "comparison")
